<?php

namespace app\common\model\welfare;

use app\common\model\BaseModel;

class Officer extends BaseModel
{

    protected $pk = 'welfare_officer_id';
    protected $name = 'welfare_officer';

    public function bgImage()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'bg_image_id');
    }

    public function qrCode()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'qr_code_id');
    }

    public function supplier()
    {
        return $this->hasOne('app\\common\\model\\supplier\\Supplier', 'shop_supplier_id', 'shop_supplier_id')->visible(['name', 'shop_supplier_id']);
    }


    /**
     * 详情
     * @return static
     */
    public static function detail($welfare_officer_id, $with = [])
    {
        return (new static())->with($with)->find($welfare_officer_id);
    }
}